//
//  ProductPicTableViewCell.m
//  ChunLaiZhuangClient
//
//  Created by xielihui on 16/4/19.
//  Copyright © 2016年 CLZ. All rights reserved.
//

#import "ProductPicTableViewCell.h"
#import "SDCycleScrollView.h"
#import "ProdcutDetaiModel.h"

@interface ProductPicTableViewCell()
@property(nonatomic, strong) SDCycleScrollView *picView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *spaceLineHeightCons;
@property(nonatomic, strong) ProdcutDetaiModel *productModel;
@end

@implementation ProductPicTableViewCell

- (void)awakeFromNib {
    // Initialization code
    self.spaceLineHeightCons.constant = .33f;
}

- (SDCycleScrollView *)picView {
    if (!_picView) {
        NSArray *UrlStringArray = self.productModel.data.images;
        _picView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 416) delegate:nil placeholderImage:nil];
        _picView.pageControlAliment = SDCycleScrollViewPageContolAlimentRight;
        _picView.imageURLStringsGroup = UrlStringArray;
        _picView.autoScroll = NO;
        _picView.pageControlAliment = SDCycleScrollViewPageContolAlimentCenter;
        _picView.currentPageDotImage=[UIImage imageNamed:@"icon_xuanye2"];
        _picView.pageDotImage=[UIImage imageNamed:@"icon_xuanye1"];
    }
    if (_picView.superview) {
        [_picView removeFromSuperview];
    }
    return _picView;
}

- (void)updateWithProductModel:(ProdcutDetaiModel *)productModel {
    self.productModel = productModel;
    [self.contentView addSubview:self.picView];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
